package pl.edu.agh.som.winfrequency;

import pl.edu.agh.som.Node;

public class DefaultWinFrequencyUpdateFunction implements IWinFrequencyUpdateFunction {

    private double beta;

    public DefaultWinFrequencyUpdateFunction(double beta) {
        this.beta = beta;
    }

    @Override
    public double evaluate(Node node, boolean isWinner) {
        double f = node.getWinFrequency();
        return isWinner ? (f + beta * (1.0 - f)) : (f + beta * (0.0 - f));
    }
}
